import Vue from 'vue';
import _popUp from './popUp';
/* eslint-disable */
const POPUP = (config) => {
  POPUP.zIndex ++;
  const popUp = Vue.extend(_popUp);
  const popUpInstance = new popUp({
    data: {
      type: config.type,
      message: config.message,
      interval: config.interval,
    },
  });
  popUpInstance.vm = popUpInstance.$mount();
  popUpInstance.dom = popUpInstance.vm.$el;
  popUpInstance.dom.style.zIndex = popUp.zIndex;
  document.body.append(popUpInstance.dom);
  return popUpInstance.vm;
};
POPUP.zIndex = 1;

export default {
  install() {
    Vue.prototype.$popUp = POPUP;
  },
};
